package com.citycloud.ccuap.tc.admin.clientresourceinterfacerel;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.citycloud.ccuap.commons.json.TreeNode;
import com.citycloud.ccuap.framework.service.mybatis.MybatisServiceImpl;
import com.citycloud.ccuap.tc.admin.entity.SysClientResourceInterfaceRel;
import com.citycloud.ccuap.tc.admin.repository.SysClientResourceInterfaceRelRepository;

/**
 * 应用资源接口关联业务处理实现
 * @author zhusr
 *
 */
@Service
public class ClientResourceInterfaceRelService extends MybatisServiceImpl<SysClientResourceInterfaceRelRepository, SysClientResourceInterfaceRel, Long> implements IClientResourceInterfaceRelService {

    @Autowired
    private ClientResourceInterfaceRelMapper clientResourceInterfaceRelMapper;
    @Autowired
    private SysClientResourceInterfaceRelRepository sysClientResourceInterfaceRelRepository;

    @Override
    public void saveSysClientResourceInterfaceRels(List<SysClientResourceInterfaceRel> sysClientResourceInterfaceRels, String resourceId) {
        sysClientResourceInterfaceRelRepository.deleteByResourceId(resourceId);
        sysClientResourceInterfaceRelRepository.saveAll(sysClientResourceInterfaceRels);
    }

    @Override
    public List<Map<String, Object>> queryAll(String resourceId) {
        return clientResourceInterfaceRelMapper.queryAll(resourceId);
    }
}